package net.cctms.zhishu;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.launcher.ARouter;

import net.cctms.zhishu.webAppFramework.contact.UrlName;
import net.cctms.zhishu.webAppFramework.model.PicEntity;
import net.cctms.zhishu.webAppFramework.ui.GestureImageActivity;
import net.cctms.zhishu.webAppFramework.ui.video.MyVideoActivity;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    Button goimage,govideo,dsbridge;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        goimage=findViewById(R.id.goimage);
        govideo=findViewById(R.id.govideo);
        dsbridge=findViewById(R.id.dsbridge);
        govideo.setOnClickListener(this);
        goimage.setOnClickListener(this);
        dsbridge.setOnClickListener(this);
    }
    private static final String FROM = "from";
    public static final String ENTITY_DATA = "entity_data";
    public static final String POSITION = "position";
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.goimage:
                ArrayList<PicEntity> picEntities=new ArrayList<>();
                PicEntity picEntity=new PicEntity();
              /*  picEntity.picUrl="http://pic.sc.chinaz.com/Files/pic/pic9/201804/zzpic11491_s.jpg";*/
               picEntity.originalPicUrl="http://pic.sc.chinaz.com/Files/pic/pic9/201804/zzpic11491_s.jpg";
               /* picEntity.isGif=0;
                picEntity.id="1";
                picEntity.keyGifPicUrl="http://pic.sc.chinaz.com/Files/pic/pic9/201804/zzpic11491_s.jpg";*/
                PicEntity picEntity1=new PicEntity();
                picEntity1.picUrl="http://pic.sc.chinaz.com/Files/pic/pic9/201805/zzpic11633_s.jpg";
                /*picEntity1.originalPicUrl="http://pic.sc.chinaz.com/Files/pic/pic9/201805/zzpic11633_s.jpg";
                picEntity1.isGif=0;
                picEntity1.id="1";
                picEntity1.keyGifPicUrl="http://pic.sc.chinaz.com/Files/pic/pic9/201805/zzpic11633_s.jpg";*/
                picEntities.add(picEntity);
                picEntities.add(picEntity1);
                ARouter.getInstance().
                        build("/zhishu/GestureImageActivity").
                        withInt(UrlName.POSITION,0).
                        withInt(UrlName.pageFrom,0).
                        withParcelableArrayList(UrlName.ENTITY_DATA,picEntities).
                        navigation();




            break;
            case R.id.govideo:
                String url="http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";
                ARouter.getInstance().
                        build("/zhishu/MyVideoActivity").
                        withString(UrlName.ARTICLE_ID,"111111").withString(UrlName.CONTENT_URL,url).withString(UrlName.ORIGINAL_URL,url).
                        withString(UrlName.VIDEO_TITLE,"标题").withString(UrlName.VIDEO_URL,url).withString(UrlName.VIDEO_SUMMARY,"视频描述").withString(UrlName.PAGE_FROM,"视频来源").
                        navigation();
                break;
            case R.id.dsbridge:
                Intent intent=new Intent(MainActivity.this,DSBridgeActivity.class);
                startActivity(intent);
                break;
        }
    }
}
